﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Dao;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition
{
    public partial class Default : BasePage
    {
        StringBuilder sb = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = WebTitle;
            if (MembershipService.GetLoginUser() == null)
            {
                ltrZs.Text = "<a href='/Login.aspx'>参展报名</a>";
            }
            else {
                ltrZs.Text = "<a href='/ExhibitionPage.aspx'>参展报名</a>";
            }
        }

        public string GetNews(int start,int num,int navid) {
            List<ContentModel> mdls = CenterService.contentService.GetNews(start, num, navid);
            foreach (var m in mdls) {
                sb.AppendFormat("<li><a href=\"{0}\" title=\"{1}\">{2}</a></li>", "NewsDetail.aspx?Id=" + m.Id, m.Title, m.Title.Length >= 20 ? m.Title.Substring(0, 20) : m.Title);
            }
            return sb.ToString();
        }

        public string GetInfo(int tpid) {

            NavModel nvmdl = CenterService.navService.GetOneById(tpid);

            return nvmdl.NavDesc ;
        }
        public string LoadPtype() {
            List<ProductClassModel> pmdls = CenterService.productClassService.GetListByPid(stmd.Id);
            foreach (var c in pmdls) {
                sb2.AppendFormat("{0}|",c.ClassName);
            }

            return sb2.ToString();
        }
    }
}